import Vue from "vue"
import Vuex from "vuex"
import {request} from "../request/request"
Vue.use(Vuex)
export default new Vuex.Store({
    state:{
        num:10
    },
    mutations:{
        getNum(state,payload){
            state.num = payload
        }
    },
    actions:{
        getSyncNum(context,number){
            request({
                url:"/list",
                method:"POST",
                data:{
                    id:number
                }
            }).then(res=>{
                let data = res.data
                if(data.code==="03"){
                    context.commit("getNum",data.data)
                }
            })
        }
    }

})